//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    tel:app.globalData.tel,
    TabCur:1,
    selectProvince: {
      show: false,
      value: '',
    },
    plate: '',
  },
  // 显示省份键盘
  selectProvinceShow: function () {
    this.setData({
      selectProvince: {
        ...this.data.selectProvince,
        show: true,
      }
    });
  },
  // 选择省份键盘获得改变
  selectProvinceChange: function (e) {
    console.log(e)
    this.setData({
      selectProvince: {
        show: false,
        value: e.detail
      }
    });
  },
  tabSelect(e) {
    this.setData({
      TabCur: e.currentTarget.dataset.id,
      scrollLeft: (e.currentTarget.dataset.id - 1) * 60
    })
  },
  tel(e){
  //  wx.makePhoneCall({
  //    phoneNumber:app.globalData.tel,
  //  })
  console.log(e)
    wx.navigateToMiniProgram({
      appId: 'wxbcad394b3d99dac9',
      path: 'pages/route/index',
      extraData: {
        appid: 'wx426a3015555a46be',
        sub_appid:
          'wx426a3015555a46b1',
        mch_id: '10000098',
        sub_mch_id: '10000096',
        nonce_str:
          'FF1A406564EE70106445',
        sign_type:
          'HMAC-SHA256',
        sign: 'EE088059BBC9141264F8D14293AD6C4BB94CEA8C08AA98FBF93E262D445F8FF5',
        trade_scene: 'PARKING',
        openid:
          'oUpF8uMEb4qRXf22hE3X68TekukE'
      },
      success(res) {
        console.log('success')
      },
      fail(res) {
        console.log(res)
        // 未成功跳转到车主小程序
      }
    })
  },
  topage(e){
   var id = e.target.dataset.id||''
  var page = e.target.dataset.page
    if (page) {
      wx.navigateTo({
        url: page + '?id=' + id,
      })
    }
  },
  onLoad: function () {
    let param={
      "phone": "15738389014",
      "signType": "4"
    }
    let token ='145fa34d6d2c415aa5720df2ae9acb19';
    wx.setStorageSync('vToken', token)
    // wx.$api.sendMessage(param).then(res=>{
    //   console.log(res)
    // })
    let param2={
      "code": 375881,
      "phone": "15738389014",
      "source": "CHONGQINGPUBLIC",
      "verToken":token,
      "yyeCode": "string"
    }
  // wx.$api.login(param2).then(res=>{
  //   console.log(res)
  // })
  },
  onShow(){
    let param = {
      pageSize: 10,
    source: "GDBJYY",
    status: 0,
    targetPage: 1
    }
    wx.$api.pageList(param).then(res => {
      console.log(res)
      console.log('查询')
    })
    wx.$api.escortEquityBuy({}).then(res=>{
      console.log("剩余")
      console.log(res)
    })
    wx.$api.escortEquityBuy({}).then(res=>{
      console.log(res)
      console.log("购买信息")
    })
    console.log("diaoyong")
    wx.$api.genPayAuthCode({}).then(res=>{
      console.log(res)
      console.log("erwiema信息")
    })
  },
  onShareAppMessage: function () {
    var that = this;
    var share = app.globalData.share
    var share_title = app.globalData.share.title
    return {
      title: app.globalData.share.title,
      imageUrl: app.globalData.share.thumb,
      path: '/pages/index/index'
    }
  },


})
